package service

import (
	"project-im/config"
	"project-im/internal/model/dao"
)

// 查询是否注册过
func IsRegister(userName string) bool {
	var user dao.ImUser
	config.DB.Where("user_name=?", userName).Limit(1).Find(&user)
	if user.ID == 0 {
		return false
	} else {
		return true
	}
}

// 判断用户状态是否被封禁
func IsBanned(userName string) bool {
	var user dao.ImUser
	config.DB.Where("user_name=?", userName).Limit(1).Find(&user)
	if user.IsBanned != 0 {
		return false
	} else {
		return true
	}
}
